package com.jms.demo.springbootactiveMq.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class JmsController {
    @Autowired
    private JmsMessagingTemplate template;

    @GetMapping("topic")
    public void sendMessage(final String message) {
        template.convertAndSend("publish.topic", message);  //调用convertAndSend方法，将信息发送进去
    }
}
